/*
 * DIM-SUM操作系统 - fixup exception
 *
 * Copyright (C) 2023 国科础石(重庆)软件有限公司
 *
 * 作者: Dong Peng <w-pengdong@kernelsoft.com>
 *
 * License terms: GNU General Public License (GPL) version 3
 *
 */
#include <asm/exception.h>
#include <asm/uaccess.h>


int fixup_exception(struct exception_spot *spot)
{
	const struct exception_table_entry *fixup;
    unsigned long ip = instruction_pointer(spot);
	printk("%s : current pc[%lx]\n", __func__, ip);
	fixup = search_exception_tables(ip);
	printk("%s : search_exception_tables fixup[%lx]\n", __func__, fixup);
	if (fixup)
		spot->sepc = (unsigned long)&fixup->fixup + fixup->fixup;
	printk("%s : pc[%lx] -> next pc[%lx]\n", __func__, ip, spot->sepc);

	return fixup != NULL;
}